//
// Created by Zeppyrz on 2025/11/5.
//

#ifndef ZEDISK_ZEDISKCLIENT_H
#define ZEDISK_ZEDISKCLIENT_H

#include <QObject>

// forward declaration
namespace ZeDisk {
class ThreadPool;
}

namespace ZeDiskGUI {

class ZeDiskClient : public QObject {
  Q_OBJECT

 public:
  static ZeDiskClient &GetInstance();
  /**
   * @brief 获取目录，只是发送请求消息到服务段
   *
   */
  void GetDir();
  /**
   * @brief 上传文件
   * @param filepath 文件路径
   */
  void Upload(std::string filepath);
  void Download(std::string file_name, std::string local_path);

  std::string &root() { return root_; }
  std::string &server_ip() { return server_ip_; }
  int &server_port() { return server_port_; }

 signals:
  void DirSig(std::string dirs);
  void UploadCompleteSig();
  void DownloadCompleteSig();



 protected:
  ZeDiskClient();
  ~ZeDiskClient() = default;

 private:
  std::string root_;
  std::string server_ip_;
  int server_port_{};

  ZeDisk::ThreadPool *threadpool_;
};

}  // namespace ZeDiskGUI

#endif  // ZEDISK_ZEDISKCLIENT_H
